<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">

		<link type="text/css" rel="stylesheet" href="__TMPL__/public/user/return/css/base.css" />
		<link type="text/css" rel="stylesheet" href="__TMPL__/public/user/return/css/sub.css" />
		<link type="text/css" rel="stylesheet" href="__TMPL__/public/user/return/css/module.css"  />
		<script type="text/javascript" src="__TMPL__/public/assets/js/jquery.min.js"></script>
		<script type="text/javascript" src="__TMPL__/public/assets/js/layer/mobile/layer.js"></script>
		<script type="text/javascript" src="__TMPL__/public/assets/js/lrz.all.bundle.js"></script>
		<link rel="stylesheet" type="text/css" href="__TMPL__/public/assets/css/mobileSelect.css"/>
		<script src="__TMPL__/public/assets/js/mobileSelect.min.js"></script>
		<title>退换货</title>
		<style>
			.top_first{height: 45px;
				font-size: 16px;
				line-height: 45px;
				padding-left: 4%;
				border-bottom: 1px solid #D7D7D7;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;}
			.state {
				width: 100%;
				height: 55px;
				background-color: #23262f;
				color: #d9b97c;
				text-align: center;
				line-height: 55px;
				font-size: 18px;
			}
			 .submit{
				width: 100%;
				margin-left: 0;
				height: 50px;
				background-color: #fff;
				border-top: 1px solid #F2F2F2!important;
			}
			.submit i{
				font-style: normal;
				margin-right: 4%;
				float: right;
				line-height: 20px;
			}
			 .submit i:nth-of-type(1){
				border: 1px solid #ddc38a;
				padding: 5px 10px 5px 10px;
				margin-top: 12px;
				color:#ddc38a ;
				border-radius: 5px;
			}
			.submit i:nth-of-type(2){
				border: 1px solid #676767;
				padding: 5px 10px 5px 10px;
				margin-top: 12px;
				color:#676767 ;
				border-radius: 5px;
			}
		</style>
	</head>
	<body>
		<div class="header"  style="border-bottom: 1px solid #d7d7d75e;">
		<h1>退换货</h1>
        
		<a href="javascript:history.back(-1);" class="back"><span></span></a>
		<a href="javascript:;" class=""></a>
</div>
<div class="shopping">
	<div class="state">
		<span>{:cmf_get_order_status($orders_info.order_status)}</span>
	</div>
		<div class="shop">
			<foreach name="orders_info['order_goods']" item="vo">
				<php>$photo=json_decode($vo['goods_picture'],true);</php>
			<div class="pic1">
				<img src="{:cmf_get_image_preview_url($photo.thumbnail)}"/>
				<p><span>{$vo.goods_name}</span></p>
				<p><span>×{$vo.num}</span></p>
			</div>
			</foreach>
			<div class="rtdetail">
				<div><span>类型</span>
					<eq name="orders_info['refund_type']" value="2"><span class="change"data="2">换货</span></eq>
					<eq name="orders_info['refund_type']" value="1"><span class="change" data="1">退货</span></eq>
				</div>
				<div><span>总价</span><span style="float:  right;padding-right: 15px;">￥{$orders_info.pay_money}+{$orders_info.pay_point}积分</span></div>
				<div><span>申请退款现金</span><span style="float:  right;padding-right: 15px;">{$orders_info['refund_require_money']}</span></div>
				<div><span>申请退款积分</span><span style="float:  right;padding-right: 15px;">{$orders_info['refund_require_score']}</span></div>

				<div><span>退换原因</span></div>
				<div class="rtpic" style=" position: relative;float: left;width: 100%;">
					<textarea class="txt"  name="" rows="5"  class="text" cols="" placeholder="请说明您购买商品遇到的问题，便于审核人员快速了解问题" maxlength="140" readonly>{$orders_info['refund_reason']}</textarea>
					<php>
						$imgs=json_decode($orders_info['refund_img'],true);
					</php>
                   <foreach name="imgs" item="v">
					   <php>if($v){</php>
					   <img src="{$v}"style="margin-bottom: 5px;">
					   <php>}</php>
				   </foreach>
				</div>

				<notempty name="orders_info['refund_no_reason']">
					<div class="top_first" style="border-top: 1px solid #D7D7D7;">
						<span >退换货拒绝原因</span>：&nbsp;&nbsp;&nbsp;{$orders_info['refund_no_reason']}
					</div>
				</notempty>
				<php>if($orders_info['order_status']==6||$orders_info['order_status']>=8){</php>
					<div class="top_first" style="border-top: 10px solid #D7D7D7;">
                      <span>【买家发货】</span>
                      <php>
                      	if(isset($orders_info['refund_user_shipping_code'])){
                        if($orders_info['refund_user_shipping_code']!=null||$orders_info['refund_user_shipping_code']!=''){
                      </php>
                  
                      <php>}}</php>
              		</div>
					<div class="top_first"><span >物流公司</span> <span id="wuliu" style="cursor: pointer;float:  right;margin-right: 15px;">{$o_name|default='请选择'} </span></div>
					<div class="top_first"><span >物流单号</span> <span style="float:  right;padding-right: 15px;"><input type="number" placeholder="请填写物流单号" class="return_company_code" value="{$orders_info['refund_user_shipping_code']|default=''}"></span></div>
				    <input type="hidden" class="f_company" value="{$orders_info['refund_user_shipping_company']|default=''}" >
				<php>}</php>
				<egt name="orders_info['order_status']" value="10">
					<div class="top_first" style="border-top: 10px solid #D7D7D7;">
                      <span>【卖家发货】</span>
                      <php>
                      	if(isset($orders_info['refund_shipping_code'])){
                        if($orders_info['refund_shipping_code']!=null||$orders_info['refund_shipping_code']!=''){
                      </php>
                     
                      <php>}}</php>
                  </div>
					<div class="top_first" ><span >物流公司</span> <span style="cursor: pointer;float:  right;margin-right: 15px;background-color: white;padding:  0;"> {:get_logistics($orders_info['refund_shipping_company'])}</span></div>
					<div class="top_first"><span >物流单号</span> <span style="cursor: pointer;float:  right;margin-right: 15px;"> {$orders_info['refund_shipping_code']}</span></div>
				</egt>
			</div>
		</div>
	<div class="submit">
		<php>if($orders_info['order_status']==6||$orders_info['order_status']==8){</php>
			<i class="return_order_fa"  data="{$orders_info['order_id']}">发货</i>
		<php>}</php>
		<php>if($orders_info['order_status']==9){</php>
		<i>等待商家发货</i>
		<php>}</php>
		<php>if($orders_info['order_status']==10){</php>
		<i class="order_get">确认收货</i>
		<php>}</php>
		<php>if($orders_info['order_status']==11){</php>
		<i>买家收货，换货完成</i>
		<php>}</php>
      <php>if($orders_info['order_status']==12){</php>
		<i>退货完成</i>
		<php>}</php>
		<lt name="orders_info['order_status']" value="9">
			<i class="return_order_close" data="{$orders_info['order_id']}">取消</i>
		</lt>
	</div>
</div>

		<script>
            var mobileSelect1 = new MobileSelect({
                trigger: '#wuliu',
                title: '物流公司',
                wheels: [
                    {data:{$newdata}}
                ],
                position:[{$o_key|default='0'}],
                callback:function(indexArr, data){
                    $('.f_company').val(data[0]['id'])
                }
            });
            $('.order_get').click(function(){
                var order_id="{$orders_info['order_id']}";
                layer.open({
                    content: '您是否确认收货'
                    ,btn: ['是的', '不了']
                    ,yes: function(index){
                        $.ajax({
                            type: "POST",
                            url: '/user/order/return_order_get',
                            data: {
                                order_id:order_id
                            },
                            dataType: "json",
                            success: function (data) {
                                layer.open({
                                    content: data.msg
                                    ,skin: 'msg'
                                    ,time: 2 //2秒后自动关闭
                                });
                                setTimeout('location.href="/user/order/detail/id/'+order_id+'"',1000)
                            }
                        });
                    }
                });
			})
            $('.return_order_fa').click(function () {
                var order_id="{$orders_info['order_id']}";
                var return_company_code=$('.return_company_code').val();
                var f_company=$('.f_company').val();
			   if(f_company==''){
                   layer.open({
                       content: '请选择物流公司'
                       ,skin: 'msg'
                       ,time: 2 //2秒后自动关闭
                   });
                   return;
			   }
                if(return_company_code==''){
                    layer.open({
                        content: '请输入物流单号'
                        ,skin: 'msg'
                        ,time: 2 //2秒后自动关闭
                    });
                    return;
                }
                $.ajax({
                    type: "POST",
                    url: '/user/order/return_order_fa',
                    data: {
                        order_id:order_id,
                        return_company_code:return_company_code,
                        f_company:f_company,
                    },
                    dataType: "json",
                    success: function (data) {
                        layer.open({
                            content: data.msg
                            ,skin: 'msg'
                            ,time: 2 //2秒后自动关闭
                        });
                        setTimeout('window.location.reload()',1000)
                    }
                });
            })
            $('.return_order_close').click(function () {
                var order_id="{$orders_info['order_id']}";
                layer.open({
                    content: '您是否要取消退换货？一旦取消，无法再次申请退换货，请谨慎操作！'
                    ,btn: ['是的', '不了']
                    ,yes: function(index){
                        $.ajax({
                            type: "POST",
                            url: '/user/order/return_order_close',
                            data: {
                                order_id:order_id
                            },
                            dataType: "json",
                            success: function (data) {
                                layer.open({
                                    content: data.msg
                                    ,skin: 'msg'
                                    ,time: 2 //2秒后自动关闭
                                });
                                setTimeout('location.href="/user/order/detail/id/'+order_id+'"',1000)
                            }
                        });
                    }
                });

            })
		</script>


	</body>
</html>
